package com.memoryangelapplication;
/*
 * User Register With The Device Confirmation*/
import java.util.ArrayList;
import java.util.HashMap;
import com.memoryangelapplication.R;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MemoryAngelListViewUserAdapter extends BaseAdapter {


	// Declare Variables
	Context context;
	LayoutInflater inflater;
	ArrayList<HashMap<String, String>> data;

	// ImageLoader imageLoader;

	public MemoryAngelListViewUserAdapter(Context context,
			ArrayList<HashMap<String, String>> arraylist) {
		this.context = context;
		data = arraylist;
		// imageLoader = new ImageLoader(context);

	}

	@Override
	public int getCount() {
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	public View getView(final int position, View convertView, ViewGroup parent) {
		// Declare Variables
		TextView m_angel_opname;

		inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View itemView = inflater.inflate(R.layout.memory_angel_users_raw,
				parent, false);
		// Get the position from the results
		HashMap<String, String> resultp = new HashMap<String, String>();
		resultp = data.get(position);

		// Locate the TextViews in listview_item.xml
		m_angel_opname = (TextView) itemView.findViewById(R.id.op_name);
		// Capture position and set results to the TextViews
		m_angel_opname.setText(resultp.get(MemoryAngelUserRegister.MEM_OPNAME));

		itemView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// Get the position from the results
				HashMap<String, String> resultp = new HashMap<String, String>();
				resultp = data.get(position);
				// Send single item click data to SingleItemView Class
				Intent intent = new Intent(context, MemoryAngelEventsList.class);
				// Pass all data m_name_in_card
				intent.putExtra("mem_angel_opID",
						resultp.get(MemoryAngelUserRegister.MEM_OPID));
				intent.putExtra("mem_state_ID","NEW");
			//	intent.putExtra("ACTION","NEW");
				context.startActivity(intent);

			}
		});

		return itemView;
	}
}
